package com.hfkh;

import sun.nio.cs.ext.MacArabic;

import java.util.Arrays;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class New04 {
    public static void main(String[] args) {
        int[][] score = new int[3][5];
        int[] total = new int[3];
        System.out.println("给二维数组附值初始前，打印数组："+ Arrays.deepToString(score));
        for (int i = 0; i < score.length; i++) {
            for (int j = 0; j < score[i].length; j++) {
                score[i][j] =  (int)(Math.random()*100+1);
            }
        }
        System.out.println("给二维数组附值初始前，打印数组："+ Arrays.deepToString(score));
        System.out.print("Java"+"\tJSP"+"\tCoreJava"+"\tMySQL"+"\tHTML5\n");
        for (int i = 0; i < score.length; i++) {
            for (int j = 0; j < score[i].length; j++) {
                System.out.print(score[i][j]+"\t\t");
            }
            System.out.println();
        }

        for (int i = 0; i < score.length; i++) {
            for (int j = 0; j < score[i].length; j++) {
                total[i] += score[i][j];
            }
            System.out.println("第"+(i+1)+"个学生的总成绩为："+total[i]);
        }
        int[] avg= new int[5];
        int[] sum = new int[5];
        for (int i = 0; i < score.length; i++) {
            for (int j = 0; j < score[i].length; j++) {
                sum[i] += score[i][j];
            }
        }
        for (int i = 0; i <score.length ; i++) {
            avg[i]  =  sum[i]/score.length;
        }
        System.out.println(Arrays.toString(avg));
    }
}
